<?php

/**
 * Buil 
 */
class Zend_View_Helper_Categoryurl extends Zend_View_Helper_Abstract {

    public function Categoryurl($strCategoryCode = '', $strParentCate = '') {
        $strCatUrl = '';
        if(!empty($strParentCate)){
            $strCatUrl = $strParentCate . '/';
        }
        if(is_numeric($strCategoryCode)){
            $objCate = Category::getInstance();
            $arrDeatail = $objCate->getDetailbyCateId($strCategoryCode);
            $strCatUrl = $objCate->getCodeParent($arrDeatail['parent_id']);
            if(!empty($strCatUrl)){
                $strCatUrl .= '/';
            }
            $strCategoryCode = $arrDeatail['catecode'];           
        }
        if($strCategoryCode === "video" || $strCategoryCode === "photo" || $strCategoryCode == 'lich-thi-dau'){
            $strCatUrl .= $strCategoryCode;
        }else{
            $strCatUrl =  PREFIX_URL . $strCatUrl . $strCategoryCode;

        }
        
        return BASE_URL . '/' . $strCatUrl;
        
    }

}